
#include "video/RenderQueueGroup.h"
#include <algorithm>

namespace KEngine
{

RenderQueueGroup::RenderQueueGroup(RenderQueue* parent)
{

}

RenderQueueGroup::~RenderQueueGroup()
{

}

void RenderQueueGroup::addRenderable(Renderable* renderable)
{
	mRenderableList.push_back(renderable);
}

void RenderQueueGroup::sort(Camera* cam)
{
	std::stable_sort(mRenderableList.begin(), mRenderableList.end(), DepthSortDescendingLess(cam));
}

void RenderQueueGroup::clear()
{
	mRenderableList.clear();
}

void RenderQueueGroup::renderObjectsList(Camera* camera, TimeValue t)
{
	RenderableList::iterator i;
	RenderableList::iterator iend = mRenderableList.end();
	for (i = mRenderableList.begin(); i != iend; ++i)
	{
		(*i)->render(camera, t);
	}
}
}